@extends('layouts.base')

@section('title', '数据统计')
@section('admin-style')
<link rel="stylesheet" href="{{ asset('assets\element-ui\lib\theme-chalk\index.css') }}">
<!-- import Vue before Element -->
<script src="{{ asset('assets\vue\vue.js')}}"></script>

<!-- import JavaScript -->
<script src="{{ asset('assets\element-ui\lib\index.js') }}"></script>
<script src="{{ asset('assets\axios\axios.min.js') }}"></script>
@stop
@section('content')

<!-- ============================================================== -->
<!-- Container fluid  -->
<!-- ============================================================== -->
<div class="container-fluid">
	<!-- ============================================================== -->
	<!-- Bread crumb and right sidebar toggle -->
	<!-- ============================================================== -->
	<div class="row page-titles">
	    <div class="col-md-5 align-self-center">
	        <h3 class="text-themecolor">缺货货道</h3>
	    </div>
	    <div class="col-md-7 align-self-center">
	        <ol class="breadcrumb">
	            <li class="breadcrumb-item"><a href="javascript:void(0)">首页</a></li>
	            <li class="breadcrumb-item">数据统计</li>
	            <li class="breadcrumb-item active">缺货货道</li>
	        </ol>
	    </div>
	</div>
	<!-- ============================================================== -->
	<!-- End Bread crumb and right sidebar toggle -->
	<!-- ============================================================== -->
 
	<!-- ============================================================== -->
	<!-- Start Page Content -->
	<!-- ============================================================== -->
	<div class="row">
        <!-- .col -->
        <div class="col-12">
            <div class="card card-body">
                <div class="row">
                    {{-- <div class="col-md-4 col-lg-3 text-center">
                        <a href="app-contact-detail.html"><img src="../assets/images/users/1.jpg" alt="user" class="img-circle img-responsive"></a>
                    </div> --}}
                    <div class="col-md-8">
                        <span>缺货总计</span>
                        <el-divider direction="vertical"></el-divider>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="row">
        <!-- .col -->
        <div class="col-12">
            <div class="card card-body">
                <div class="row">
                    {{-- <div class="col-md-4 col-lg-3 text-center">
                        <a href="app-contact-detail.html"><img src="../assets/images/users/1.jpg" alt="user" class="img-circle img-responsive"></a>
                    </div> --}}
                    <div class="col-md-8">
                        <h3 class="box-title m-b-0">Johnathan Doe</h3> <small>Web Designer</small>
                        <span>
                            795 Folsom Ave, Suite 600 San Francisco, CADGE 94107电饭锅四个是大法官是大法官是大法官是大法官是大法官是大法官是大法官是大法官是大法官是大法官是大法官
                            <br/>
                            <br/>
                            <abbr title="Phone">P:</abbr> (123) 456-7890
                        </span>
                    </div>
                </div>
            </div>
        </div>
    </div>
    {{-- {{ $notices->links() }} --}}
	               
</div>         
                        
@stop

@section('admin-js')
	<script type="text/javascript">		

		Vue.prototype.$axios = axios;
	    Vue.prototype.$dcopy = function($arr){
	        return JSON.parse(JSON.stringify($arr));
	    }
	    new Vue({
	    	el: '#app',
            data(){
            	return {                  
                  nextActive:false,
              }
            },
            created(){

            },
            mounted(){
                
            },
            methods:{
            	publishNotice(id){
            		var that = this
            		swal({
					  title: "您确定要发布此消息吗?",
					  icon: "warning",
					  buttons: ['取消', '确定'],
					  dangerMode: true,
					})
					.then((willDelete) => {
					  if (willDelete) {			    
					    axios.get("{{ route('admin.notices.publishNotice') }}", {
	            			params:{'id':id}
	            		}).
	            		then(res => {
	            			if(res.data.code == 400){
					    		that.$message.error(res.data.message);
					    	}
					    	if(res.data.code == 200){
					    		that.$message.success(res.data.message);
					    	}
	            		});
					  }
					});            		
            	},
            	del(id){
            		var that = this;
            		swal({
					  title: "您确定要删除吗?",
					  icon: "warning",
					  buttons: ['取消', '确定'],
					  dangerMode: true,
					})
					.then((willDelete) => {
					  if (willDelete) {			    
					    axios.post("{{ route('admin.notices.delete') }}",{'id':id})
					    .then(res => {
					    	if(res.data.code == 400){
					    		that.$message.error(res.data.message);
					    	}
					    	if(res.data.code == 200){
					    		that.$message.success(res.data.message);
					    		location.href = "{{ route('admin.notices.index') }}"
					    	}
					    });
					  } else {
					    
					  }
					});
            	}
            }
	    });
		
	</script>

@stop